package com.dayuanit;

import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.BufferedInputStream; 






public class Test {

	/**
	 * @param args
	 */
	public static void system() throws IOException {
		BufferedInputStream bis = new BufferedInputStream(System.in);
		OutputStream output = new FileOutputStream(new File("z.txt"));
		
		int flag = 0;
		byte[] buf = new byte[1024];
		while(0 != (flag = bis.read(buf))) {
			output.write(buf, 0, flag);
			output.flush();
			
		}
	}
	
	public static void pic() throws IOException {
		InputStream input = new FileInputStream(new File("camera.jpg"));
		byte[] buf = new byte[1024];
		int flag = 0;
		
		OutputStream output = new FileOutputStream(new File("camera1.jpg"));
		while(-1 != (flag = input.read(buf))) {
			//String str = new String(buf, 0, flag);
			output.write(buf, 0, flag);
		}
		
		output.flush();
	}
	
	public static void main(String[] args) throws IOException {
		/*File file = new File("x.txt");
		InputStream input = new FileInputStream(file);
		byte[] buf = new byte[1024];
		int flag = 0;
		String msg = "";
		while(-1 != (flag = input.read(buf))) {
			msg += new String(buf, 0, flag);
		}
		System.out.println("read = " + msg);
		
		OutputStream output = new FileOutputStream(new File("y.txt"));
		output.write(msg.getByte());
		output.flush();
		*/
		Test.pic();
	
	}

}
